﻿using UnityEngine;
using System;
using System.Collections.Generic;
using System.Security;
namespace GX
{
    public class UICO
    {
        public string name { get; private set; }
        public int hashCode { get; private set; }
        public string className { get; private set; }
        public string path { get; private set; }
        public int layer { get; private set; }

        public float delayDestroySeconds { get; private set; }
        public bool isFullscreen { get; private set; }

        public string[] subPaths { get; private set; }
        public void Parse(SecurityElement node)
        {
            this.name = node.Attribute("name");
            this.hashCode = this.name.GetHashCode();
            this.className = node.Attribute("className");
            this.path = node.Attribute("path");
            this.layer = node.Attribute("layer").GetInt();
            this.delayDestroySeconds = node.Attribute("delayDestroySeconds").GetFloat();
            this.isFullscreen = node.Attribute("isFullscreen").GetBool();

            int numSubPaths = null == node.Children ? 0 : node.Children.Count;
            subPaths = new string[numSubPaths];
            for (int i = 0; i < numSubPaths; ++i)
            {
                subPaths[i] = (node.Children[i] as SecurityElement).Attribute("path");
            }
            Debugger.Log(this.name +":" + this.className + "->" + this.path);
        }
    }
}